package com.neuedu.service.impl;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.neuedu.domain.Articleinfo;
import com.neuedu.domain.Articletype;
import com.neuedu.domain.Collectioninfo;
import com.neuedu.domain.Commentinfo;
import com.neuedu.domain.Mineinfo;
import com.neuedu.domain.Page;
import com.neuedu.domain.Userinfo;
import com.neuedu.mapper.ArticleMapper;
import com.neuedu.service.ArticleService;
import com.neuedu.util.SqlSessionFactoryUtil;
@Service
public class ArticleServiceImpl implements ArticleService{
	@Autowired
	ArticleMapper am ;
	@Override
	public List<Articletype> loadArticleType(Userinfo userinfo) {
		
		return am.loadArticleType(userinfo);
	}

	@Override
	@Transactional
	public int releaseArticle(Articleinfo articleinfo) {
		am.updateKissNum(articleinfo);
		am.releaseArticle(articleinfo);
		return 1;
	}

	@Override
	public List<Map<String, Object>> getIndexArticleInfo() {
		// TODO Auto-generated method stub
		return am.getIndexArticleInfo();
	}

	@Override
	public List<Map<String, Object>> getIndexStick() {
		// TODO Auto-generated method stub
		return am.getIndexStick();
	}

	@Override
	public int getTotalCounts() {
		// TODO Auto-generated method stub
		return am.getTotalCounts();
	}

	@Override
	public List<Map<String, Object>> getIndexNoStick(Page page) {
		// TODO Auto-generated method stub
		return am.getIndexNoStick(page);
	}

	@Override
	@Transactional
	public Map<String, Object> getArticleDetail(int artid) {
		// TODO Auto-generated method stub
		am.addPageView(artid);
		return am.getArticleDetail(artid);
	}

	@Override
	@Transactional
	public int delArtById(int artid) {
		int count = am.delArtById(artid);
		return count;
	}

	@Override
	@Transactional
	public int upStickById(int artid) {
		int count = am.upStickById(artid);
		return count;
	}

	@Override
	@Transactional
	public int upNoStickById(int artid) {
		int count = am.upNoStickById(artid);
		return count;
	}

	@Override
	@Transactional
	public int upCreamById(int artid) {
		int count = am.upCreamById(artid);
		return count;
	}

	@Override
	@Transactional
	public int upNoCreamById(int artid) {
		int count = am.upNoCreamById(artid);
		return count;
	}

	@Override
	@Transactional
	public int addMainComment(Commentinfo info) {
		am.addCommentNum(info);
		am.addMainComment(info);
		return 1;
	}

	@Override
	public List<Map<String, Object>> getCommentByArtId(int artid) {
		// TODO Auto-generated method stub
		return am.getCommentByArtId(artid);
	}

	@Override
	public List<Map<String, Object>> getHotTieByArtId() {
		// TODO Auto-generated method stub
		return am.getHotTieByArtId();
	}

	@Override
	public List<Map<String, Object>> getHotVisitByArtId() {
		// TODO Auto-generated method stub
		return am.getHotVisitByArtId();
	}

	@Override
	public List<Map<String, Object>> getAnswer() {
		// TODO Auto-generated method stub
		return am.getAnswer();
	}

	@Override
	@Transactional
	public int upCaina(int artid) {
		int count = am.upCaina(artid);
		return count;
	}

	@Override
	@Transactional
	public int upIsaccept(Commentinfo ci) {
		int count = am.upIsaccept(ci);
		int count1 = am.upacckiss(ci);
		return count;
	}

	@Override
	@Transactional
	public int addcollects(Collectioninfo coll) {
		int count = am.addcollects(coll);				
		return count;
	}

	@Override
	@Transactional
	public int delAnById(int id) {
		int count = am.delAnById(id);
		return count;
	}

	@Override
	public int getCollById(Collectioninfo coll) {
		int count = am.getCollById(coll);
		return count;
	}

	@Override
	@Transactional
	public int nocollects(Collectioninfo coll) {
		int count = am.nocollects(coll);
		return count;
	}

	@Override
	public Map<String, Object> upArticleDetail(int artid) {
		// TODO Auto-generated method stub
		return am.upArticleDetail(artid);
	}

	@Override
	@Transactional
	public int upReleaseArticle(Articleinfo articleinfo) {
		am.upReleaseArticle(articleinfo);
		return 0;
	}

	@Override
	public int selectOldPaykiss(int artid) {
		// TODO Auto-generated method stub
		return am.selectOldPaykiss(artid);
	}

	@Override
	public List<Map<String, Object>> selectall1(Page page) {
		// TODO Auto-generated method stub
		return am.selectall1(page);
	}

	@Override
	public int getTotalCount1() {
		// TODO Auto-generated method stub
		return am.getTotalCount1();
	}

	@Override
	public List<Map<String, Object>> selectall2(Page page) {
		// TODO Auto-generated method stub
		return am.selectall2(page);
	}

	@Override
	public int getTotalCount2() {
		// TODO Auto-generated method stub
		return am.getTotalCount2();
	}

	@Override
	public List<Map<String, Object>> selectall3(Page page) {
		// TODO Auto-generated method stub
		return am.selectall3(page);
	}

	@Override
	public int getTotalCount3() {
		// TODO Auto-generated method stub
		return am.getTotalCount3();
	}

	@Override
	public List<Map<String, Object>> selectall4(Page page) {
		// TODO Auto-generated method stub
		return am.selectall4(page);
	}

	@Override
	public int getTotalCount4() {
		// TODO Auto-generated method stub
		return am.getTotalCount4();
	}

	@Override
	@Transactional
	public int zanOkById(int id) {
		int count = am.zanOkById(id);
		return count;
	}
	@Override
	public List<Map<String, Object>> getMineMsg(int id) {
		
		return am.getMineMsg(id);
	}
	@Override
	@Transactional
	public int addMineMsg(Mineinfo mine) {
		int count = am.addMineMsg(mine);
		return count;
	}



}
